<include file="Public:header" />
<style type="text/css">
.upload_c{ width:187px; height:124px; border:1px solid #c6c6c6; background:#fafafa; margin:0 auto; text-align:center;}
.upload_c select{ width:162px; height:23px; line-height:23px; margin:23px 0 18px 0;}
.upload_btn{ background:../Public/personal/images/upload_bt.jpg no-repeat; width:157px; height:42px; border:none;}
</style>
<link href="../Public/personal/css/edit.css" rel="stylesheet" type="text/css" />
<script language='JavaScript'>
$(document).ready(function(){
 $('#password').blur(function(){
	 var val=$('#password').val();
	 $.post("{:U('Personal/checkpass')}",{val:val},function(res){
		 if(res==0) {
			 $('#reginal').html("<font color='red' class='wrong' id='wrong'>密码错误</font>");
			 return false;
		 }
		 if(res==1) $('#wrong').remove();
	 });
  });
 $('#newpass').blur(function(){
	var length=  $('#newpass').val().length;
	var reg = /^\s*$/g;
	 if($('#newpass').val()=="" || reg.test($('#newpass').val())){
		  $('#newp').html("<font class= 'wrong' id='wrong_emp' color='red'>密码不能为空</font>");
		  return false;
	  }
	 else if(length<6||length>16){
		  $('#newp').html("<font class= 'wrong' id='wrong_length' color='red'>长度必须6~16个字符</font>");
		  return false;
		 }
	 else{ 
		$('#wrong_emp').remove();
		$('#wrong_length').remove();
	 }
 });
 $('#repass').blur(function(){
	if($(this).val()!=$('#newpass').val()){
		$('#conp').html("<font class='wrong' id='wrong_same' color='red'>两次密码不一样</font>");
	     return false;
	}
	else $('#wrong_same').remove();
 });
 $('#but').click(function(){
	var numError=$('.wrong').length;
	if($('#password').val()==""){
		$('#reginal').html("<font class= 'wrong' id='wrong_emp' color='red'>原密码不能为空</font>");
	  	return false;
	}
	if($('#newpass').val()==""){
		$('#newp').html("<font class= 'wrong' id='wrong_emp' color='red'>密码不能为空</font>");
	  	return false;
	}
	if($('#repass').val()==""){
		$('#conp').html("<font class= 'wrong' id='wrong_emp' color='red'>密码不能为空</font>");
	  	return false;
	}
	if(numError) return false;
	else{
		alert('修改密码成功！');
		$('#foom').submit();
	}
 });
})
</script>
<div class="content">
<div class="crumbs">当前位置：<a href="#">个人空间</a> > <a href="#">编辑资料</a> > <a href="#">基本信息</a></div>
<div class="w_content">
<div class="c_l">
<div class="c_lt">
<div class="per_info">
<eq name='basic.image' value=''><img src="__PUBLIC__/Uploads/PersonImage/per_img.jpg" />
<else/><img src="__PUBLIC__/Uploads/PersonImage/s_{$basic['image']}" />
</eq>
<div class="pinfo">
<p class="pname">{$basic['nickname']}</p>
<p class="plevel">等 级：{$basic['lname']}</p>
<p class="pintegral">积 分：{$basic['score']}分</p>
<a href="{:U('user/logout')}" ><input onclick="window.location.href='{:U('user/logout')}'" style="cursor:pointer;" type="button" value="退出系统" class="exit_btn"/></a>
</div>
<div class="clear"></div>
</div>
<ul>
<li class="resources"><a href="{:U('Personal/mysource')}">我的资源</a></li>
<li class="favorite"><a href="{:U('Personal/favorite')}">我的收藏夹</a></li>
<li class="edit">
<dl>
<dt>
<a href="{:U('Personal/basicinfo')}">编辑资料</a>
</dt>
<dd><a href="{:U('Personal/basicinfo')}">基本信息</a></dd>
<dd><a href="{:U('Personal/password')}" class="current">修改密码</a></dd>
<dd><a href="{:U('Personal/image')}">修改头像</a></dd>
</dl>
</li>
<li class="friend"><a href="{:U('Personal/friend')}">我的好友</a></li>
<li class="message"><a href="{:U('Personal/message')}">短消息({$urcount}未读)</a></li>
</ul>
</div>
<div class="c_lb">
<div class="upload_c">
<select id="cate">
<option value="1">图片</option>
<option value="2">视频</option>
<option value="3">动画</option>
<option value="4">游戏</option>
<option value="5">文章</option>
<option value="6">挂图</option>
<option value="7">图书</option>
<option value="8">展品</option>
<option value="9">知识题</option>
</select>
<img style="cursor:pointer;" src="../Public/personal/images/upload_bt.jpg" onclick="upload();" />
</div>
</div>
</div>
<div class="c_m">
<div class="c_mtab">
<form id='foom' action="{:U('Personal/password')}" method='post'>
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td colspan="2" class="tabtittle" height="70">修改密码</td>
</tr>
<tr>
<td height="40">原密码：</td>
<td align="left"><input type="password"  class="etext"  id='password'/></td>
<td width='120px' id='reginal' align='left'></td>
</tr>
<tr>
<td height="40">新密码：</td>
<td align="left"><input type="password"  class="etext" name='password' id='newpass'/></td>
<td id='newp' align='left'></td>
</tr>
<tr>
<td height="40">确认密码：</td>
<td align="left"><input type="password" class="etext" id='repass'/></td>
<td id='conp' align='left'></td>
</tr>
<tr>
<td height="70">&nbsp;</td>
<td align="center"><input type="button" id='but' class="save_bt"/></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<script type="text/javascript">
function upload()
{
	var cate=$("#cate").val();

	switch (parseInt(cate))
	{
		case 1:window.location.href="{:U('Picture/upload')}";break;
		case 2:window.location.href="{:U('Video/upload')}";break;
		case 3:window.location.href="{:U('Flash/upload')}";break;
		case 4:window.location.href="{:U('Game/upload')}";break;
		case 5:window.location.href="{:U('Article/upload')}";break;
		case 6:window.location.href="{:U('Image/upload')}";break;
		case 7:window.location.href="{:U('Book/upload')}";break;
		case 8:window.location.href="{:U('Exhibits/upload')}";break;
		case 9:window.location.href="{:U('Knowledge/upload')}";break;
	}
}
</script>
<include file="Public:footer" />
